<template>
  <div>
    <div class="login-box">
      <h3 class="title">登录界面</h3>
      <el-form
        ref="ruleFormRef"
        :model="ruleForm"
        status-icon
        
        label-width="65px"
        class="demo-ruleForm"
      >
        <el-form-item label="账号" prop="pass">
          <el-input
            v-model="ruleForm.pass"
            type="text"
            autocomplete="off"
          />
        </el-form-item>
        <el-form-item label="密码" prop="checkPass">
          <el-input
            v-model="ruleForm.checkPass"
            type="password"
            autocomplete="off"
          />
        </el-form-item>
        
        <el-form-item>

          <!-- <el-button type="primary" @click="submitForm">提交</el-button> -->
          <el-button type="primary" @click="submitForm">提交</el-button>
          
          <el-button @click="resetForm(ruleFormRef)">取消</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue'
import type { FormInstance } from 'element-plus'

const ruleFormRef = ref<FormInstance>()





const ruleForm = reactive({
  pass: 'admin',
  checkPass: '666666',
})



const submitForm = (formEl: FormInstance | undefined) => {
  let admin='admin'
  localStorage.setItem('admin',admin)  
  location.href='http://127.0.0.1:5173/'
}

const resetForm = (formEl: FormInstance | undefined) => {
  if (!formEl) return
  formEl.resetFields()
}
</script>

 


<style lang="less" scoped>
.login-box {
  width: 400px;
  height: 300px;
  padding: 20px;
  margin: 150px auto;
  border-radius: 10px;
  border: 1px solid #eee;
  background-color: #fff;
}
.title {
  margin-bottom: 30px;
  text-align: center;
  color: #666;
}
</style>